package cn.imvc.app.domains;

import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;

//订单状态 ：10创建订单、11用户取消订单、12系统取消订单、13管理员驳回订单、
//20付款中、21付款成功、22付款失败  23、取消付款订单
//30待发货、31已发货、32发货失败
//40确认收货、41系统确认收货
//50退货申请、51审核通过、52审核失败、53退货成功 54退货失败
//60订单完成
//70已分佣
public enum OrderState {
    Create(10) {
        public String toString() {
            return "创建订单";
        }
    },
    UserCancel(11) {
        public String toString() {
            return "用户取消订单";
        }
    },
    SystemCancel(12) {
        public String toString() {
            return "系统取消订单";
        }
    },
    AdminCancel(13) {
        public String toString() {
            return "管理员驳回订单";
        }
    },
    Payment(20) {
        public String toString() { return "付款中"; }
    },
    PaySuccess(21) {
        public String toString() {
            return "付款成功";
        }
    },
    PayFailed(22) {
        public String toString() { return "付款失败"; }
    },
    PayCancel(23){
    	 public String toString() { return "取消付款订单"; }
    },
    Delivery(30) {
        public String toString() { return "待发货"; }
    },
    Delivered(31) {
        public String toString() { return "已发货"; }
    },
    DeliveryFailed(32) {
        public String toString() { return "发货失败"; }
    },
    Receipt(40) {
        public String toString() { return "确认收货"; }
    },
    SystemReceipt(41) {
        public String toString() { return "系统确认收货"; }
    },
    RefundApply(50) {
        public String toString() { return "退货申请"; }
    },
    Pass(51) {
        public String toString() { return "审核通过"; }
    },
    Reject(52) {
        public String toString() { return "审核失败"; }
    },
    RefundSuccess(53) {
        public String toString() { return "退货成功"; }
    },
    RefundFailed(54) {
        public String toString() { return "退货失败"; }
    },
    Finish(60) {
        public String toString() { return "订单完成"; }
    },
    Commissions(70){
    	 public String toString() { return "已分佣"; }
    },
    Comments(80){
   	 public String toString() { return "已评价"; }
   };;

    private final Byte val;

    OrderState(int n) {
        val = (byte) n;
    }

    public Byte getValue() {
        return val;
    }
    public static OrderState getByIntValue(int n) {
        switch (n) {
            case 10:
                return Create;
            case 11:
                return UserCancel;
            case 12:
                return SystemCancel;
            case 13:
                return AdminCancel;
            case 20:
                return Payment;
            case 21:
                return PaySuccess;
            case 22:
                return PayFailed;
            case 23:
            	return PayCancel;
            case 30:
                return Delivery;
            case 31:
                return Delivered;
            case 32:
                return DeliveryFailed;
            case 40:
                return Receipt;
            case 41:
                return SystemReceipt;
            case 50:
                return RefundApply;
            case 51:
                return Pass;
            case 52:
                return Reject;
            case 53:
                return RefundSuccess;
            case 54:
                return RefundFailed;
            case 60:
                return Finish;
            case 70:
            	return Commissions;
            case 80:
            	return Comments;
            default:
                return null;
        }
    }
    
    public static final Map<Byte, String> elMap = new HashMap<Byte, String>();  
  
    static {  
        for (OrderState s : EnumSet.allOf(OrderState.class)) {  
        	elMap.put(s.getValue(), s.toString());  
        }  
    }
}